One area in which look up tables are extensively used are in routing tables for use by a router. A router is a switching device which receives a packet, and based on destination information contained within the data packet, routes the packet to its destination.
Each packet contains a header field and data field. The header field contains control information associated with the routing of the packet including source and destination information. On receiving a packet, a router identifies the key in the header field. The key contains the information that is used to look up the route for the received packet.
The look up table includes a plurality of entries having a route destination associated with a “key”. After a key for a packet has been determined, the router performs the look-up in the look up table for the matching entry and hence the destination associated with the key and routes the packet accordingly. A given key may typically match a large number of routes in the look up table.
Traditional routing processes using a conventional look up table are very time consuming. One known method to speed up this look up process is to cache the most recent or often performed matches.
Furthermore it is difficult to update conventional look up tables to change routing information.
One solution to this is to provide a look up table in which the entries are stored in a special format, known as a “trie”. A trie is a multi-way tree structure used for organising data to optimise lookup performance. The data is organized as a set of linked nodes, in a tree structure. Each trie node contains a power-of-two number of entries. Each entry is either empty or contains the lookup result. If the entry is empty, it will point to another trie node and the look up process is repeated. If the entry contains the look up value, this value is returned and the look up process is effectively terminated.
A particular form of such a trie is a level-compressed trie (LC-trie) data structure also known as a “Patricia” tree (Practical Alogorithm to Retrieve Information Coded In Alphanumeric).
A traditional trie uses every part (bit or characters) of the key. in turn, to determine which subtree to select. However, a Patricia tree nominates (by storing its position in the node) which element of the key will next be used to determine the branching. This removes the need for any nodes with just one descendent and consequently the Patricia tree utilises less memory than that required by a traditional trie. However, Patricia trees are fairly expensive to generate, so a table which utilises such a format is best used in applications for which lookup speed is more important than update speed. However, with increasing complexity of routers and hence the increased size of such look tables, it has become increasingly important to increase the speed of look up and the accuracy of lookup.